﻿#pragma once
#include "../../../common/utils/BinaryFileReader.h"
#include "IVideoRenderView.h"
#include <thread>
#include <QString>

class VideoRenderViewController
{
private:
	IVideoRenderView* iVideoRenderView = NULL;
	bool isRunning = true;
	std::unique_ptr<std::thread> renderThread;
	char* data = NULL;
	int linesize = 0;
	BinaryFileReader* binaryFileReader = nullptr;
public:
	int mWidth = 0;
	int mHeight = 0;
	int fps = 25;//fps默认25帧每秒
	IVideoRenderView::PixFormat mPixFormat = IVideoRenderView::PixFormat::RGBA;
	void* win_id = NULL;
	QString mFilePath = NULL;

public:
	static VideoRenderViewController* Get()
	{
		static VideoRenderViewController vrvc;
		return &vrvc;
	}
	QString Init();
	void Close();
	void Start();//开启线程
	void Draw();
	void Resize(int width, int height);
};
